package cn.kgc.cjk_yy.tools;

import java.util.List;

/*
分页工具类
        页面所有需要显示的信息都 封装在这里
        查询条件，显示的数据，每页面多少条，多少页，多少条记录……
 */
public class PageDto<T> {
        //要显示的条数
        private int pagesize=5;
        //总共多少页
        private int totalpages;
        //总共多少条记录
        private int totalcount;
        //当前页
        private int pagenum;
        //数据
        private List<T> list;
        // 请求地址
        private String urlpath;
     //给后台
        private int start;
        private T  querydata;

        //逼方法调用者必须传递pagenum,totalcount
    public PageDto(int pagenum, int totalcount){
        this.pagenum=pagenum;
        this.totalcount=totalcount;
        this.totalpages=(totalcount+pagesize-1)/pagesize;
        this.start=(pagenum-1)*pagesize;
    }


    public int getPagesize() {
        return pagesize;
    }

    public void setPagesize(int pagesize) {
        this.pagesize = pagesize;
    }

    public int getTotalpages() {
        return totalpages;
    }

    public void setTotalpages(int totalpages) {
        this.totalpages = totalpages;
    }

    public int getTotalcount() {
        return totalcount;
    }

    public void setTotalcount(int totalcount) {
        this.totalcount = totalcount;
    }

    public int getPagenum() {
        return pagenum;
    }

    public void setPagenum(int pagenum) {
        this.pagenum = pagenum;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public String getUrlpath() {
        return urlpath;
    }

    public void setUrlpath(String urlpath) {
        this.urlpath = urlpath;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public T getQuerydata() {
        return querydata;
    }

    public void setQuerydata(T querydata) {
        this.querydata = querydata;
    }
}
